#ifndef __M_LOG_H__
#define __M_LOG_H__
#include <iostream>
#include <ctime>

#define DEB_LEVER 0
#define INF_LEVER 1
#define ERR_LEVER 2
#define DEFAULT_LEVER DEB_LEVER

#define DLOG(format,...) LOG("DEB",DEB_LEVER,format,##__VA_ARGS__)
#define ILOG(format,...) LOG("INF",INF_LEVER,format,##__VA_ARGS__)
#define ELOG(format,...) LOG("ERR",ERR_LEVER,format,##__VA_ARGS__)

#define LOG(lev_str,level,format,...) {\
    if(level >= DEFAULT_LEVER)\
    {\
        time_t now = time(nullptr);\
        struct tm* local_time = localtime(&now);\
        printf("[%s][%d-%d-%d %d:%d:%d][%s:%d]\t" format "\n",lev_str,\
            local_time->tm_year+1900,local_time->tm_mon+1,local_time->tm_mday,\
            local_time->tm_hour,local_time->tm_min,local_time->tm_sec,\
            __FILE__,__LINE__,##__VA_ARGS__);\
    }\
}
#endif